package com.ximu.message;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class MessageAction extends ActionSupport{

	public String list() throws Exception{
		MessageImp imp = new MessageImp();
		HttpServletRequest request = ServletActionContext.getRequest();
		request.setAttribute("messageList", imp.getAll());
		return "list";
	}
	
	public String add() throws Exception{
		
		return "add";
	}
	
	public String save() throws Exception{
		MessageImp imp = new MessageImp();
		imp.save();
		return "add";
	}
	
	public String del() throws Exception{
		MessageImp imp = new MessageImp();
		imp.del();
		HttpServletRequest request = ServletActionContext.getRequest();
		request.setAttribute("messageList", imp.getAll());
		return "list";
	}
}
